package com.mao.server.utils;

import com.mao.server.constant.ResultConstant;
import lombok.*;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private String code;
    private String msg;
    private Object data;


    public static Result success() {
        return new Result(ResultConstant.SUCCESS, ResultConstant.SUCCESS_MSG, null);
    }

    public static Result success(Object data) {
        return new Result(ResultConstant.SUCCESS, ResultConstant.SUCCESS_MSG, data);
    }

    public static Result error(String msg) {
        return new Result(ResultConstant.SYS_ERROR, msg, null);
    }

    public static Result error(String code, String msg) {
        return new Result(code, msg, null);
    }

    public static Result error() {
        return new Result(ResultConstant.SYS_ERROR, ResultConstant.SYS_ERROR_MSG, null);
    }

}
